package Gui;

import Logica.CreacionInformacion;
import Oracle.OracleMethods;
import java.sql.*;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author Alonso
 */
public class BaseDatosGUI extends javax.swing.JFrame {
    String resultadoModal = "";
    String resultadoModalDirec = "";
    
    /** Creates new form BaseDatosGUI */
    public BaseDatosGUI() throws SQLException {
        initComponents();
        llenarTablaKiosco();
        llenarTablaClientes();
        llenarTablaDirec();
        llenarTablaMaterial();
        llenarTablaMaterial1();
        this.setLocationRelativeTo(null);
    }
    
    //Metodo para llenenar la informacion de la tabla de kioscos
    private void llenarTablaKiosco() throws SQLException {
        
        DefaultTableModel kioscoTable = new DefaultTableModel();
        kioscoTable.addColumn("ID Number");
        kioscoTable.addColumn("Nombre");
        kioscoTable.addColumn("Dueño");
        kioscoTable.addColumn("CI Dueño");
        
        Connection con = OracleMethods.oracleConnection();
        Statement sentencia = con.createStatement();
        ResultSet kioscoSet = sentencia.executeQuery("SELECT * FROM ao_kiosco");
        
         while(kioscoSet.next()) { 
            Vector row = new Vector();
            row.add(kioscoSet.getInt("kiosco_PK"));
            row.add(kioscoSet.getString("nombre"));
            row.add(kioscoSet.getString("dueno_nombre"));
            row.add(kioscoSet.getString("dueno_ci"));
            kioscoTable.addRow(row);
         }
            
            this.tableKiosco.setModel(kioscoTable);
            this.tableKiosco.setVisible(true);
            
            sentencia.close();
            kioscoSet.close();
            con.close();
        
    }
    
    //Metodo para llenenar la informacion de la tabla de clietes
    private void llenarTablaClientes() throws SQLException {
        
        DefaultTableModel clientesTable = new DefaultTableModel();
        clientesTable.addColumn("RIF");
        clientesTable.addColumn("Empresa");
       
        
        Connection con = OracleMethods.oracleConnection();
        Statement sentencia = con.createStatement();
        ResultSet clienteSet = sentencia.executeQuery("SELECT * FROM ao_cliente");
        
         while(clienteSet.next()) { 
            Vector row = new Vector();
            row.add(clienteSet.getString("rif_PK"));
            row.add(clienteSet.getString("nombreEmpresa"));
            clientesTable.addRow(row);
         }
            
            this.tableCliente.setModel(clientesTable);
            this.tableCliente.setVisible(true);
            
            sentencia.close();
            clienteSet.close();    
            con.close();
    }
    
    private void llenarTablaDirec() throws SQLException {
        
        DefaultTableModel direcTable = new DefaultTableModel();
        direcTable.addColumn("ID");
        direcTable.addColumn("Nombre");
        direcTable.addColumn("Tipo");
       
        
        Connection con = OracleMethods.oracleConnection();
        Statement sentencia = con.createStatement(); 
        ResultSet direcSet = sentencia.executeQuery("SELECT * FROM ao_direccion");
        
         while(direcSet.next()) { 
            Vector row = new Vector();
            row.add(direcSet.getString("direccion_pk"));
            row.add(direcSet.getString("nombre"));
            row.add(direcSet.getString("tipo"));
            direcTable.addRow(row);
         }
            
            this.tableDirec.setModel(direcTable);
            this.tableDirec.setVisible(true);
            
            sentencia.close();
            direcSet.close();   
            con.close();
    }
    
    public final void llenarFormasPagoTable() throws SQLException {
        this.formasPago_Table.removeAll();
        
        DefaultTableModel dm = new DefaultTableModel();
        dm.addColumn("Nro");
        dm.addColumn("Tipo");
        dm.addColumn("Descuento");
        
        Connection con = OracleMethods.oracleConnection();
        Statement stmt = con.createStatement();
        ResultSet rs = stmt.executeQuery("SELECT * FROM ao_forma_pago");
            
        while(rs.next()) { 
            Vector row = new Vector();
            row.add(rs.getInt("formaPago_PK"));
            row.add(rs.getString("nombre"));
            row.add(rs.getString("descuento"));
            dm.addRow(row);
        }
        
        
        this.formasPago_Table.setModel(dm);
        //this.infoPubli_Table.setDefaultRenderer(String.class, new TableRender());
        this.formasPago_Table.setVisible(true);
   
        stmt.close();
        rs.close();
        con.close();
    }
    
    public final void llenarTablaMaterial() throws SQLException {
        
        DefaultTableModel dm = new DefaultTableModel();
        dm.addColumn("Nro");
        dm.addColumn("Nombre");
        
        Connection con = OracleMethods.oracleConnection();
        Statement stmt = con.createStatement();
        ResultSet rs = stmt.executeQuery("SELECT * FROM ao_material");
            
        while(rs.next()) { 
            Vector row = new Vector();
            row.add(rs.getInt("material_PK"));
            row.add(rs.getString("material"));
            dm.addRow(row);
        }
        
        
        this.tablaValla.setModel(dm);
        //this.infoPubli_Table.setDefaultRenderer(String.class, new TableRender());
        this.tablaValla.setVisible(true);
   
        stmt.close();
        rs.close();
        con.close();
    }
    
    public final void llenarTablaMaterial1() throws SQLException {
        
        DefaultTableModel dm = new DefaultTableModel();
        dm.addColumn("Nro");
        dm.addColumn("Nombre");
        
        Connection con = OracleMethods.oracleConnection();
        Statement stmt = con.createStatement();
        ResultSet rs = stmt.executeQuery("SELECT * FROM ao_valla");
            
        while(rs.next()) { 
            Vector row = new Vector();
            row.add(rs.getInt("valla_PK"));
            row.add(rs.getString("tamano"));
            dm.addRow(row);
        }
        
        
        this.tablaValla1.setModel(dm);
        //this.infoPubli_Table.setDefaultRenderer(String.class, new TableRender());
        this.tablaValla1.setVisible(true);
   
        stmt.close();
        rs.close();
        con.close();
    }
    
    public final void llenarTablaMaterial2() throws SQLException {
        
        DefaultTableModel dm = new DefaultTableModel();
        dm.addColumn("Nro");
        dm.addColumn("Tamano");
        dm.addColumn("Material");
        dm.addColumn("Costo");
        
        Connection con = OracleMethods.oracleConnection();
        Statement stmt = con.createStatement();
        ResultSet rs = stmt.executeQuery("SELECT * FROM ao_valla_material");
            
        while(rs.next()) { 
            Vector row = new Vector();
            row.add(rs.getInt("valla_material_PK"));
            row.add(rs.getString("tamano"));
            row.add(rs.getString("tamano"));
            row.add(rs.getString("tamano"));
            
            dm.addRow(row);
        }
        
        
        this.tablaValla1.setModel(dm);
        //this.infoPubli_Table.setDefaultRenderer(String.class, new TableRender());
        this.tablaValla1.setVisible(true);
   
        stmt.close();
        rs.close();
        con.close();
    }
    
    
    private void limpiarTexts(){
        textCiDueno.setText("");
        textCostoAtras.setText("");
        textCostoDerecha.setText("");
        textCostoIzquierda.setText("");
        textDuenoKiosco.setText("");
        textIdKiosco.setText("");
        textNombreKiosco.setText("");
        textTelefonoKiosco.setText("");
        textCalleKiosco.setText("");
    }
    
    private void limpiarTextsCliente(){
        textRif.setText("");
        textTelefono2Cliente.setText("");
        textTelefonoCliente.setText("");
        textContacto.setText("");
        textEmpresa.setText("");
    }
    
    private void limpiarCamposFormaPago() {
        this.descuento_Text.setText("");
        this.tipoPago_Text.setText("");
        this.descuento_Text.setEditable(false);
        this.tipoPago_Text.setEditable(false);
    }
    
    private void limpiarTextsDirec(){
        textNombreDirec.setText("");
        textIdDirec.setText("");
        textPerteneceDirec.setText("");
    }
    
    private boolean camposVaciosKiosco(){
        if(textCiDueno.getText().isEmpty() || textCostoAtras.getText().isEmpty() || textCostoDerecha.getText().isEmpty() ||
           textCostoIzquierda.getText().isEmpty() || textCalleKiosco.getText().isEmpty() || textDuenoKiosco.getText().isEmpty() ||
           textNombreKiosco.getText().isEmpty() || textTelefonoKiosco.getText().isEmpty() ){
            JOptionPane.showMessageDialog(this, "Llene los campos vacios");
            return true;
        }
        else
            return false;
            
    }
    
    private boolean camposVaciosCliente(){
        if(textRif.getText().isEmpty() || textTelefonoCliente.getText().isEmpty() ||
           textEmpresa.getText().isEmpty() || textContacto.getText().isEmpty() ){
            JOptionPane.showMessageDialog(this, "Llene los campos vacios");
            return true;
        }
        else
            return false;
            
    }
    
    private boolean camposVaciosDirec(){
        if(textPerteneceDirec.getText().isEmpty() || textNombreDirec.getText().isEmpty() ){
            JOptionPane.showMessageDialog(this, "Llene los campos vacios");
            return true;
        }
        else
            return false;
            
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        tabbedPanel = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jPanel5 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        textIdKiosco = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        textNombreKiosco = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        textDuenoKiosco = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        textCiDueno = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        textTelefonoKiosco = new javax.swing.JTextField();
        jPanel7 = new javax.swing.JPanel();
        textCostoDerecha = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        textCostoAtras = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        textCostoIzquierda = new javax.swing.JTextField();
        jLabel27 = new javax.swing.JLabel();
        textCalleKiosco = new javax.swing.JTextField();
        jLabel28 = new javax.swing.JLabel();
        textDireccionKiosco = new javax.swing.JTextField();
        jPanel6 = new javax.swing.JPanel();
        buttonRegistrar = new javax.swing.JButton();
        buttonEditar = new javax.swing.JButton();
        buttonBorrar = new javax.swing.JButton();
        buttonGastos = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        tableKiosco = new javax.swing.JTable();
        jPanel3 = new javax.swing.JPanel();
        jPanel9 = new javax.swing.JPanel();
        jLabel16 = new javax.swing.JLabel();
        textRif = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        textContacto = new javax.swing.JTextField();
        jLabel20 = new javax.swing.JLabel();
        textTelefonoCliente = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        textEmpresa = new javax.swing.JTextField();
        jLabel22 = new javax.swing.JLabel();
        textTelefono2Cliente = new javax.swing.JTextField();
        jPanel12 = new javax.swing.JPanel();
        buttonRegistrarCliente = new javax.swing.JButton();
        buttonEditarCliente = new javax.swing.JButton();
        buttonBorrarCliente = new javax.swing.JButton();
        jScrollPane3 = new javax.swing.JScrollPane();
        tableCliente = new javax.swing.JTable();
        jPanel2 = new javax.swing.JPanel();
        jPanel8 = new javax.swing.JPanel();
        jLabel12 = new javax.swing.JLabel();
        textIdDirec = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        textNombreDirec = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        textPerteneceDirec = new javax.swing.JTextField();
        textTipoDirec = new javax.swing.JComboBox();
        jPanel13 = new javax.swing.JPanel();
        buttonRegistrarDirec = new javax.swing.JButton();
        buttonEditarDirec = new javax.swing.JButton();
        buttonBorrarDirec = new javax.swing.JButton();
        jScrollPane4 = new javax.swing.JScrollPane();
        tableDirec = new javax.swing.JTable();
        jPanel4 = new javax.swing.JPanel();
        jPanel10 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        formasPago_Table = new javax.swing.JTable();
        registroFPButton = new javax.swing.JButton();
        editarFPButton = new javax.swing.JButton();
        borrarFPButton = new javax.swing.JButton();
        jPanel11 = new javax.swing.JPanel();
        jLabel18 = new javax.swing.JLabel();
        tipoPago_Text = new javax.swing.JTextField();
        jLabel19 = new javax.swing.JLabel();
        descuento_Text = new javax.swing.JTextField();
        jPanel14 = new javax.swing.JPanel();
        jPanel15 = new javax.swing.JPanel();
        jScrollPane5 = new javax.swing.JScrollPane();
        formasPago_Table1 = new javax.swing.JTable();
        registroFPButton1 = new javax.swing.JButton();
        editarFPButton1 = new javax.swing.JButton();
        borrarFPButton1 = new javax.swing.JButton();
        jPanel16 = new javax.swing.JPanel();
        jLabel23 = new javax.swing.JLabel();
        tipoPago_Text1 = new javax.swing.JTextField();
        jLabel24 = new javax.swing.JLabel();
        descuento_Text1 = new javax.swing.JTextField();
        jPanel17 = new javax.swing.JPanel();
        jPanel20 = new javax.swing.JPanel();
        jPanel21 = new javax.swing.JPanel();
        jScrollPane7 = new javax.swing.JScrollPane();
        tablaValla = new javax.swing.JTable();
        botonRegistrarMaterial = new javax.swing.JButton();
        botonEditarMaterial = new javax.swing.JButton();
        botonBorrarMaterial = new javax.swing.JButton();
        jPanel22 = new javax.swing.JPanel();
        jLabel29 = new javax.swing.JLabel();
        textNombreMaterial = new javax.swing.JTextField();
        jLabel30 = new javax.swing.JLabel();
        textIdMaterial = new javax.swing.JTextField();
        jPanel23 = new javax.swing.JPanel();
        jPanel24 = new javax.swing.JPanel();
        jScrollPane8 = new javax.swing.JScrollPane();
        tablaValla1 = new javax.swing.JTable();
        botonRegistrarMaterial1 = new javax.swing.JButton();
        botonEditarMaterial1 = new javax.swing.JButton();
        botonBorrarMaterial1 = new javax.swing.JButton();
        jPanel25 = new javax.swing.JPanel();
        jLabel31 = new javax.swing.JLabel();
        textNombreMaterial1 = new javax.swing.JTextField();
        jLabel32 = new javax.swing.JLabel();
        textIdMaterial1 = new javax.swing.JTextField();
        jPanel26 = new javax.swing.JPanel();
        jPanel27 = new javax.swing.JPanel();
        jScrollPane9 = new javax.swing.JScrollPane();
        tablaValla2 = new javax.swing.JTable();
        botonRegistrarMaterial2 = new javax.swing.JButton();
        botonEditarMaterial2 = new javax.swing.JButton();
        botonBorrarMaterial2 = new javax.swing.JButton();
        jPanel28 = new javax.swing.JPanel();
        jLabel33 = new javax.swing.JLabel();
        textNombreVallaMaterial = new javax.swing.JTextField();
        jLabel34 = new javax.swing.JLabel();
        textIdVallaMaterial = new javax.swing.JTextField();
        jLabel35 = new javax.swing.JLabel();
        jLabel36 = new javax.swing.JLabel();
        textTamano1 = new javax.swing.JTextField();
        textTamano2 = new javax.swing.JTextField();
        jLabel37 = new javax.swing.JLabel();
        textCostoVallaMaterial = new javax.swing.JTextField();
        back_Button = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Base de Datos");
        setMinimumSize(new java.awt.Dimension(926, 490));
        setResizable(false);

        tabbedPanel.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        tabbedPanel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tabbedPanelMouseClicked(evt);
            }
        });

        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Detalles"));

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel1.setText("ID Number");

        textIdKiosco.setEditable(false);
        textIdKiosco.setText("--");

        jLabel2.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel2.setText("Nombre");

        textNombreKiosco.setEditable(false);
        textNombreKiosco.setText("--");

        jLabel3.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel3.setText("Dueño");

        textDuenoKiosco.setEditable(false);
        textDuenoKiosco.setText("--");

        jLabel4.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel4.setText("CI Dueño");

        textCiDueno.setEditable(false);
        textCiDueno.setText("--");
        textCiDueno.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                textCiDuenoKeyTyped(evt);
            }
        });

        jLabel5.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel5.setText("Telefono");

        textTelefonoKiosco.setEditable(false);
        textTelefonoKiosco.setText("--");
        textTelefonoKiosco.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                textTelefonoKioscoKeyTyped(evt);
            }
        });

        jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Costos", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 12))); // NOI18N

        textCostoDerecha.setEditable(false);
        textCostoDerecha.setText("--");
        textCostoDerecha.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                textCostoDerechaKeyTyped(evt);
            }
        });

        jLabel6.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel6.setText("Derecha");

        jLabel7.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel7.setText("Bs.");

        jLabel8.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel8.setText("Bs.");

        textCostoAtras.setEditable(false);
        textCostoAtras.setText("--");
        textCostoAtras.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                textCostoAtrasKeyTyped(evt);
            }
        });

        jLabel9.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel9.setText("Atras");

        jLabel10.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel10.setText("Izquierda");

        jLabel11.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel11.setText("Bs.");

        textCostoIzquierda.setEditable(false);
        textCostoIzquierda.setText("--");
        textCostoIzquierda.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                textCostoIzquierdaKeyTyped(evt);
            }
        });

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel10)
                    .addComponent(jLabel9)
                    .addComponent(jLabel6))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(textCostoDerecha, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(textCostoAtras, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(textCostoIzquierda, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel11))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel7)
                            .addComponent(jLabel8))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(textCostoDerecha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel7))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(textCostoAtras, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel8))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(textCostoIzquierda, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel11))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jLabel27.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel27.setText("Calle");

        textCalleKiosco.setEditable(false);
        textCalleKiosco.setText("--");

        jLabel28.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel28.setText("Dirección");

        textDireccionKiosco.setEditable(false);
        textDireccionKiosco.setText("--");
        textDireccionKiosco.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                textDireccionKioscoMouseClicked(evt);
            }
        });
        textDireccionKiosco.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textDireccionKioscoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel28)
                            .addComponent(jLabel27))
                        .addGap(23, 23, 23)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(textDireccionKiosco, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE)
                            .addComponent(textCalleKiosco, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE)))
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel2)
                            .addComponent(jLabel1)
                            .addComponent(jLabel3)
                            .addComponent(jLabel4)
                            .addComponent(jLabel5))
                        .addGap(13, 13, 13)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(textCiDueno, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE)
                            .addComponent(textDuenoKiosco, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE)
                            .addComponent(textNombreKiosco, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE)
                            .addComponent(textIdKiosco, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE)
                            .addComponent(textTelefonoKiosco, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE)))
                    .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(textIdKiosco)
                    .addComponent(jLabel1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(textNombreKiosco))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(textDuenoKiosco))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(textCiDueno))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(textTelefonoKiosco))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(textDireccionKiosco, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel28))
                .addGap(4, 4, 4)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(textCalleKiosco, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel27))
                .addGap(27, 27, 27)
                .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        buttonRegistrar.setFont(new java.awt.Font("Tahoma", 0, 13));
        buttonRegistrar.setText("Registrar");
        buttonRegistrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonRegistrarActionPerformed(evt);
            }
        });

        buttonEditar.setFont(new java.awt.Font("Tahoma", 0, 13));
        buttonEditar.setText("Editar");
        buttonEditar.setEnabled(false);
        buttonEditar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonEditarActionPerformed(evt);
            }
        });

        buttonBorrar.setFont(new java.awt.Font("Tahoma", 0, 13));
        buttonBorrar.setText("Borrar");
        buttonBorrar.setEnabled(false);
        buttonBorrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonBorrarActionPerformed(evt);
            }
        });

        buttonGastos.setFont(new java.awt.Font("Tahoma", 0, 13));
        buttonGastos.setText("Gastos");
        buttonGastos.setEnabled(false);
        buttonGastos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonGastosActionPerformed(evt);
            }
        });

        tableKiosco.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "ID Number", "Nombre", "Dueño", "CI Dueño"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tableKiosco.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tableKioscoMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(tableKiosco);

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 466, Short.MAX_VALUE)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addGap(23, 23, 23)
                        .addComponent(buttonRegistrar, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(31, 31, 31)
                        .addComponent(buttonEditar, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(buttonBorrar, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(buttonGastos, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 278, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(buttonBorrar, javax.swing.GroupLayout.DEFAULT_SIZE, 40, Short.MAX_VALUE)
                    .addComponent(buttonGastos, javax.swing.GroupLayout.DEFAULT_SIZE, 40, Short.MAX_VALUE)
                    .addComponent(buttonRegistrar, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(buttonEditar, javax.swing.GroupLayout.DEFAULT_SIZE, 40, Short.MAX_VALUE))
                .addGap(19, 19, 19))
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(38, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        tabbedPanel.addTab("Kioscos", jPanel1);

        jPanel9.setBorder(javax.swing.BorderFactory.createTitledBorder("Detalles"));

        jLabel16.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel16.setText("RIF");

        textRif.setEditable(false);
        textRif.setText("--");
        textRif.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textRifActionPerformed(evt);
            }
        });

        jLabel17.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel17.setText("Contacto");

        textContacto.setEditable(false);
        textContacto.setText("--");

        jLabel20.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel20.setText("Telefono 1");

        textTelefonoCliente.setEditable(false);
        textTelefonoCliente.setText("--");
        textTelefonoCliente.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                textTelefonoClienteKeyTyped(evt);
            }
        });

        jLabel21.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel21.setText("Empresa");

        textEmpresa.setEditable(false);
        textEmpresa.setText("--");

        jLabel22.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel22.setText("Telefono 2");

        textTelefono2Cliente.setEditable(false);
        textTelefono2Cliente.setText("--");
        textTelefono2Cliente.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                textTelefono2ClienteKeyTyped(evt);
            }
        });

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel9Layout.createSequentialGroup()
                        .addComponent(jLabel22)
                        .addGap(14, 14, 14)
                        .addComponent(textTelefono2Cliente, javax.swing.GroupLayout.DEFAULT_SIZE, 254, Short.MAX_VALUE))
                    .addGroup(jPanel9Layout.createSequentialGroup()
                        .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel20)
                            .addComponent(jLabel17)
                            .addComponent(jLabel21)
                            .addComponent(jLabel16))
                        .addGap(14, 14, 14)
                        .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(textEmpresa, javax.swing.GroupLayout.DEFAULT_SIZE, 254, Short.MAX_VALUE)
                            .addComponent(textContacto, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 254, Short.MAX_VALUE)
                            .addComponent(textTelefonoCliente, javax.swing.GroupLayout.DEFAULT_SIZE, 254, Short.MAX_VALUE)
                            .addComponent(textRif, javax.swing.GroupLayout.DEFAULT_SIZE, 254, Short.MAX_VALUE))))
                .addContainerGap())
        );
        jPanel9Layout.setVerticalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel16)
                    .addComponent(textRif))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel21)
                    .addComponent(textEmpresa))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel17)
                    .addComponent(textContacto))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel20)
                    .addComponent(textTelefonoCliente))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel22)
                    .addComponent(textTelefono2Cliente))
                .addContainerGap())
        );

        jPanel12.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        buttonRegistrarCliente.setFont(new java.awt.Font("Tahoma", 0, 13));
        buttonRegistrarCliente.setText("Registrar");
        buttonRegistrarCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonRegistrarClienteActionPerformed(evt);
            }
        });

        buttonEditarCliente.setFont(new java.awt.Font("Tahoma", 0, 13));
        buttonEditarCliente.setText("Editar");
        buttonEditarCliente.setEnabled(false);
        buttonEditarCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonEditarClienteActionPerformed(evt);
            }
        });

        buttonBorrarCliente.setFont(new java.awt.Font("Tahoma", 0, 13));
        buttonBorrarCliente.setText("Borrar");
        buttonBorrarCliente.setEnabled(false);
        buttonBorrarCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonBorrarClienteActionPerformed(evt);
            }
        });

        tableCliente.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null},
                {null, null},
                {null, null},
                {null, null}
            },
            new String [] {
                "RIF", "Empresa"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tableCliente.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tableClienteMouseClicked(evt);
            }
        });
        jScrollPane3.setViewportView(tableCliente);

        javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
        jPanel12.setLayout(jPanel12Layout);
        jPanel12Layout.setHorizontalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel12Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 466, Short.MAX_VALUE)
                    .addGroup(jPanel12Layout.createSequentialGroup()
                        .addComponent(buttonRegistrarCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(buttonEditarCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(buttonBorrarCliente, javax.swing.GroupLayout.DEFAULT_SIZE, 152, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel12Layout.setVerticalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel12Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 325, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(buttonRegistrarCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(buttonEditarCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(buttonBorrarCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(38, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        tabbedPanel.addTab("Clientes", jPanel3);

        jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder("Detalles"));

        jLabel12.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel12.setText("ID Number");

        textIdDirec.setEditable(false);
        textIdDirec.setText("--");

        jLabel13.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel13.setText("Nombre");

        textNombreDirec.setEditable(false);
        textNombreDirec.setText("--");

        jLabel14.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel14.setText("Tipo");

        jLabel15.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel15.setText("Pertenece a");

        textPerteneceDirec.setEditable(false);
        textPerteneceDirec.setText("--");
        textPerteneceDirec.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                textPerteneceDirecMouseClicked(evt);
            }
        });
        textPerteneceDirec.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textPerteneceDirecActionPerformed(evt);
            }
        });

        textTipoDirec.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Zona", "Ciudad", "Estado" }));
        textTipoDirec.setEnabled(false);
        textTipoDirec.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textTipoDirecActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel15)
                    .addComponent(jLabel13)
                    .addComponent(jLabel12)
                    .addComponent(jLabel14))
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addGap(13, 13, 13)
                        .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(textNombreDirec, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(textTipoDirec, javax.swing.GroupLayout.Alignment.LEADING, 0, 213, Short.MAX_VALUE)
                            .addComponent(textPerteneceDirec, javax.swing.GroupLayout.Alignment.LEADING)))
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(textIdDirec)))
                .addContainerGap(73, Short.MAX_VALUE))
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel12)
                    .addComponent(textIdDirec))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel13)
                    .addComponent(textNombreDirec))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel14)
                    .addComponent(textTipoDirec, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel15)
                    .addComponent(textPerteneceDirec))
                .addContainerGap())
        );

        jPanel13.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        buttonRegistrarDirec.setFont(new java.awt.Font("Tahoma", 0, 13));
        buttonRegistrarDirec.setText("Registrar");
        buttonRegistrarDirec.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonRegistrarDirecActionPerformed(evt);
            }
        });

        buttonEditarDirec.setFont(new java.awt.Font("Tahoma", 0, 13));
        buttonEditarDirec.setText("Editar");
        buttonEditarDirec.setEnabled(false);
        buttonEditarDirec.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonEditarDirecActionPerformed(evt);
            }
        });

        buttonBorrarDirec.setFont(new java.awt.Font("Tahoma", 0, 13));
        buttonBorrarDirec.setText("Borrar");
        buttonBorrarDirec.setEnabled(false);
        buttonBorrarDirec.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonBorrarDirecActionPerformed(evt);
            }
        });

        tableDirec.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null}
            },
            new String [] {
                "ID", "Nombre", "Tipo"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, true, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tableDirec.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tableDirecMouseClicked(evt);
            }
        });
        jScrollPane4.setViewportView(tableDirec);

        javax.swing.GroupLayout jPanel13Layout = new javax.swing.GroupLayout(jPanel13);
        jPanel13.setLayout(jPanel13Layout);
        jPanel13Layout.setHorizontalGroup(
            jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel13Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 466, Short.MAX_VALUE)
                    .addGroup(jPanel13Layout.createSequentialGroup()
                        .addComponent(buttonRegistrarDirec, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(buttonEditarDirec, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(buttonBorrarDirec, javax.swing.GroupLayout.DEFAULT_SIZE, 172, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel13Layout.setVerticalGroup(
            jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel13Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 325, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(buttonRegistrarDirec, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(buttonBorrarDirec, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(buttonEditarDirec, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel13, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        tabbedPanel.addTab("Direcciones", jPanel2);

        jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        formasPago_Table.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null}
            },
            new String [] {
                "Nro", "Tipo", "Descuento"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, true
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        formasPago_Table.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                formasPago_TableMouseClicked(evt);
            }
        });
        jScrollPane2.setViewportView(formasPago_Table);

        registroFPButton.setFont(new java.awt.Font("Tahoma", 0, 13));
        registroFPButton.setText("Registrar");
        registroFPButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                registroFPButtonActionPerformed(evt);
            }
        });

        editarFPButton.setFont(new java.awt.Font("Tahoma", 0, 13));
        editarFPButton.setText("Editar");
        editarFPButton.setEnabled(false);
        editarFPButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                editarFPButtonActionPerformed(evt);
            }
        });

        borrarFPButton.setFont(new java.awt.Font("Tahoma", 0, 13));
        borrarFPButton.setText("Borrar");
        borrarFPButton.setEnabled(false);
        borrarFPButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                borrarFPButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 466, Short.MAX_VALUE)
                    .addGroup(jPanel10Layout.createSequentialGroup()
                        .addComponent(registroFPButton, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(editarFPButton, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(borrarFPButton, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        jPanel10Layout.setVerticalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel10Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 318, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(registroFPButton, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(editarFPButton, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(borrarFPButton, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        jPanel11.setBorder(javax.swing.BorderFactory.createTitledBorder("Informacion tipo de pago"));

        jLabel18.setText("Tipo de pago:");

        tipoPago_Text.setEditable(false);

        jLabel19.setText("Descuento:");

        descuento_Text.setEditable(false);
        descuento_Text.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                descuento_TextActionPerformed(evt);
            }
        });
        descuento_Text.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                descuento_TextKeyTyped(evt);
            }
        });

        javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
        jPanel11.setLayout(jPanel11Layout);
        jPanel11Layout.setHorizontalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel18)
                    .addComponent(jLabel19))
                .addGap(18, 18, 18)
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(tipoPago_Text, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(descuento_Text, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(94, Short.MAX_VALUE))
        );
        jPanel11Layout.setVerticalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel18)
                    .addComponent(tipoPago_Text, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel19)
                    .addComponent(descuento_Text, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel15.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        formasPago_Table1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null}
            },
            new String [] {
                "Nro", "Tipo", "Descuento"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, true
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        formasPago_Table1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                formasPago_Table1MouseClicked(evt);
            }
        });
        jScrollPane5.setViewportView(formasPago_Table1);

        registroFPButton1.setFont(new java.awt.Font("Tahoma", 0, 13));
        registroFPButton1.setText("Registrar");
        registroFPButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                registroFPButton1ActionPerformed(evt);
            }
        });

        editarFPButton1.setFont(new java.awt.Font("Tahoma", 0, 13));
        editarFPButton1.setText("Editar");
        editarFPButton1.setEnabled(false);
        editarFPButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                editarFPButton1ActionPerformed(evt);
            }
        });

        borrarFPButton1.setFont(new java.awt.Font("Tahoma", 0, 13));
        borrarFPButton1.setText("Borrar");
        borrarFPButton1.setEnabled(false);
        borrarFPButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                borrarFPButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel15Layout = new javax.swing.GroupLayout(jPanel15);
        jPanel15.setLayout(jPanel15Layout);
        jPanel15Layout.setHorizontalGroup(
            jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel15Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane5, javax.swing.GroupLayout.DEFAULT_SIZE, 466, Short.MAX_VALUE)
                    .addGroup(jPanel15Layout.createSequentialGroup()
                        .addComponent(registroFPButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(editarFPButton1, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(borrarFPButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        jPanel15Layout.setVerticalGroup(
            jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel15Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane5, javax.swing.GroupLayout.DEFAULT_SIZE, 318, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(registroFPButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(editarFPButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(borrarFPButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        jPanel16.setBorder(javax.swing.BorderFactory.createTitledBorder("Informacion tipo de pago"));

        jLabel23.setText("Tipo de pago:");

        tipoPago_Text1.setEditable(false);

        jLabel24.setText("Descuento:");

        descuento_Text1.setEditable(false);
        descuento_Text1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                descuento_Text1ActionPerformed(evt);
            }
        });
        descuento_Text1.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                descuento_Text1KeyTyped(evt);
            }
        });

        javax.swing.GroupLayout jPanel16Layout = new javax.swing.GroupLayout(jPanel16);
        jPanel16.setLayout(jPanel16Layout);
        jPanel16Layout.setHorizontalGroup(
            jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel16Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel23)
                    .addComponent(jLabel24))
                .addGap(18, 18, 18)
                .addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(tipoPago_Text1, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(descuento_Text1, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(95, Short.MAX_VALUE))
        );
        jPanel16Layout.setVerticalGroup(
            jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel16Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel23)
                    .addComponent(tipoPago_Text1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel24)
                    .addComponent(descuento_Text1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(311, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel14Layout = new javax.swing.GroupLayout(jPanel14);
        jPanel14.setLayout(jPanel14Layout);
        jPanel14Layout.setHorizontalGroup(
            jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel14Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(60, Short.MAX_VALUE))
        );
        jPanel14Layout.setVerticalGroup(
            jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel14Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel16, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel15, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 71, Short.MAX_VALUE)
                .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
            .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel4Layout.createSequentialGroup()
                    .addGap(0, 5, Short.MAX_VALUE)
                    .addComponent(jPanel14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 5, Short.MAX_VALUE)))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGap(19, 19, 19)
                        .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jPanel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addContainerGap())
            .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel4Layout.createSequentialGroup()
                    .addGap(0, 0, Short.MAX_VALUE)
                    .addComponent(jPanel14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, Short.MAX_VALUE)))
        );

        tabbedPanel.addTab("Formas de pago", jPanel4);

        jPanel21.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        tablaValla.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null}
            },
            new String [] {
                "Nro", "Tipo", "Descuento"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, true
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tablaValla.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tablaVallaMouseClicked(evt);
            }
        });
        jScrollPane7.setViewportView(tablaValla);

        botonRegistrarMaterial.setFont(new java.awt.Font("Tahoma", 0, 13));
        botonRegistrarMaterial.setText("Registrar");
        botonRegistrarMaterial.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonRegistrarMaterialActionPerformed(evt);
            }
        });

        botonEditarMaterial.setFont(new java.awt.Font("Tahoma", 0, 13));
        botonEditarMaterial.setText("Editar");
        botonEditarMaterial.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonEditarMaterialActionPerformed(evt);
            }
        });

        botonBorrarMaterial.setFont(new java.awt.Font("Tahoma", 0, 13));
        botonBorrarMaterial.setText("Borrar");
        botonBorrarMaterial.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonBorrarMaterialActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel21Layout = new javax.swing.GroupLayout(jPanel21);
        jPanel21.setLayout(jPanel21Layout);
        jPanel21Layout.setHorizontalGroup(
            jPanel21Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel21Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel21Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane7, javax.swing.GroupLayout.DEFAULT_SIZE, 466, Short.MAX_VALUE)
                    .addGroup(jPanel21Layout.createSequentialGroup()
                        .addComponent(botonRegistrarMaterial, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(botonEditarMaterial, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(botonBorrarMaterial, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        jPanel21Layout.setVerticalGroup(
            jPanel21Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel21Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane7, javax.swing.GroupLayout.DEFAULT_SIZE, 318, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addGroup(jPanel21Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(botonRegistrarMaterial, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(botonEditarMaterial, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(botonBorrarMaterial, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        jPanel22.setBorder(javax.swing.BorderFactory.createTitledBorder("Detalles"));

        jLabel29.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel29.setText("Nombre:");

        textNombreMaterial.setEditable(false);

        jLabel30.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel30.setText("ID:");

        textIdMaterial.setEditable(false);
        textIdMaterial.setEnabled(false);

        javax.swing.GroupLayout jPanel22Layout = new javax.swing.GroupLayout(jPanel22);
        jPanel22.setLayout(jPanel22Layout);
        jPanel22Layout.setHorizontalGroup(
            jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel22Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel29)
                    .addComponent(jLabel30))
                .addGap(32, 32, 32)
                .addGroup(jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(textIdMaterial, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(textNombreMaterial, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(94, Short.MAX_VALUE))
        );
        jPanel22Layout.setVerticalGroup(
            jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel22Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel29)
                    .addComponent(textNombreMaterial, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel30)
                    .addComponent(textIdMaterial, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(323, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel20Layout = new javax.swing.GroupLayout(jPanel20);
        jPanel20.setLayout(jPanel20Layout);
        jPanel20Layout.setHorizontalGroup(
            jPanel20Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel20Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel21, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel22, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(65, Short.MAX_VALUE))
        );
        jPanel20Layout.setVerticalGroup(
            jPanel20Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel20Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel20Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel22, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel21, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        javax.swing.GroupLayout jPanel17Layout = new javax.swing.GroupLayout(jPanel17);
        jPanel17.setLayout(jPanel17Layout);
        jPanel17Layout.setHorizontalGroup(
            jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel17Layout.createSequentialGroup()
                .addGap(0, 5, Short.MAX_VALUE)
                .addComponent(jPanel20, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 10, Short.MAX_VALUE))
        );
        jPanel17Layout.setVerticalGroup(
            jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel17Layout.createSequentialGroup()
                .addGap(0, 0, Short.MAX_VALUE)
                .addComponent(jPanel20, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
        );

        tabbedPanel.addTab("Materiales", jPanel17);

        jPanel24.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        tablaValla1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null}
            },
            new String [] {
                "Nro", "Tipo", "Descuento"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, true
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tablaValla1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tablaValla1MouseClicked(evt);
            }
        });
        jScrollPane8.setViewportView(tablaValla1);

        botonRegistrarMaterial1.setFont(new java.awt.Font("Tahoma", 0, 13));
        botonRegistrarMaterial1.setText("Registrar");
        botonRegistrarMaterial1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonRegistrarMaterial1ActionPerformed(evt);
            }
        });

        botonEditarMaterial1.setFont(new java.awt.Font("Tahoma", 0, 13));
        botonEditarMaterial1.setText("Editar");
        botonEditarMaterial1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonEditarMaterial1ActionPerformed(evt);
            }
        });

        botonBorrarMaterial1.setFont(new java.awt.Font("Tahoma", 0, 13));
        botonBorrarMaterial1.setText("Borrar");
        botonBorrarMaterial1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonBorrarMaterial1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel24Layout = new javax.swing.GroupLayout(jPanel24);
        jPanel24.setLayout(jPanel24Layout);
        jPanel24Layout.setHorizontalGroup(
            jPanel24Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel24Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel24Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane8, javax.swing.GroupLayout.DEFAULT_SIZE, 466, Short.MAX_VALUE)
                    .addGroup(jPanel24Layout.createSequentialGroup()
                        .addComponent(botonRegistrarMaterial1, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(botonEditarMaterial1, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(botonBorrarMaterial1, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        jPanel24Layout.setVerticalGroup(
            jPanel24Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel24Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane8, javax.swing.GroupLayout.DEFAULT_SIZE, 318, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addGroup(jPanel24Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(botonRegistrarMaterial1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(botonEditarMaterial1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(botonBorrarMaterial1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        jPanel25.setBorder(javax.swing.BorderFactory.createTitledBorder("Detalles"));

        jLabel31.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel31.setText("Nombre:");

        textNombreMaterial1.setEditable(false);

        jLabel32.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel32.setText("ID:");

        textIdMaterial1.setEditable(false);
        textIdMaterial1.setEnabled(false);

        javax.swing.GroupLayout jPanel25Layout = new javax.swing.GroupLayout(jPanel25);
        jPanel25.setLayout(jPanel25Layout);
        jPanel25Layout.setHorizontalGroup(
            jPanel25Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel25Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel25Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel31)
                    .addComponent(jLabel32))
                .addGap(32, 32, 32)
                .addGroup(jPanel25Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(textIdMaterial1, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(textNombreMaterial1, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(94, Short.MAX_VALUE))
        );
        jPanel25Layout.setVerticalGroup(
            jPanel25Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel25Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel25Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel31)
                    .addComponent(textNombreMaterial1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel25Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel32)
                    .addComponent(textIdMaterial1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(323, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel23Layout = new javax.swing.GroupLayout(jPanel23);
        jPanel23.setLayout(jPanel23Layout);
        jPanel23Layout.setHorizontalGroup(
            jPanel23Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel23Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel24, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel25, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(80, Short.MAX_VALUE))
        );
        jPanel23Layout.setVerticalGroup(
            jPanel23Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel23Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel23Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel25, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel24, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        tabbedPanel.addTab("Valla", jPanel23);

        jPanel27.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        tablaValla2.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null}
            },
            new String [] {
                "Nro", "Tipo", "Descuento"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, true
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tablaValla2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tablaValla2MouseClicked(evt);
            }
        });
        jScrollPane9.setViewportView(tablaValla2);

        botonRegistrarMaterial2.setFont(new java.awt.Font("Tahoma", 0, 13));
        botonRegistrarMaterial2.setText("Registrar");
        botonRegistrarMaterial2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonRegistrarMaterial2ActionPerformed(evt);
            }
        });

        botonEditarMaterial2.setFont(new java.awt.Font("Tahoma", 0, 13));
        botonEditarMaterial2.setText("Editar");
        botonEditarMaterial2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonEditarMaterial2ActionPerformed(evt);
            }
        });

        botonBorrarMaterial2.setFont(new java.awt.Font("Tahoma", 0, 13));
        botonBorrarMaterial2.setText("Borrar");
        botonBorrarMaterial2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonBorrarMaterial2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel27Layout = new javax.swing.GroupLayout(jPanel27);
        jPanel27.setLayout(jPanel27Layout);
        jPanel27Layout.setHorizontalGroup(
            jPanel27Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel27Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel27Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane9, javax.swing.GroupLayout.DEFAULT_SIZE, 466, Short.MAX_VALUE)
                    .addGroup(jPanel27Layout.createSequentialGroup()
                        .addComponent(botonRegistrarMaterial2, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(botonEditarMaterial2, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(botonBorrarMaterial2, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        jPanel27Layout.setVerticalGroup(
            jPanel27Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel27Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane9, javax.swing.GroupLayout.DEFAULT_SIZE, 318, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addGroup(jPanel27Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(botonRegistrarMaterial2, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(botonEditarMaterial2, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(botonBorrarMaterial2, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        jPanel28.setBorder(javax.swing.BorderFactory.createTitledBorder("Detalles"));

        jLabel33.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel33.setText("Material");

        textNombreVallaMaterial.setEditable(false);

        jLabel34.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel34.setText("ID:");

        textIdVallaMaterial.setEditable(false);
        textIdVallaMaterial.setEnabled(false);

        jLabel35.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel35.setText("Tamano:");

        jLabel36.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel36.setText("Costo:");

        textTamano1.setEditable(false);
        textTamano1.setEnabled(false);

        textTamano2.setEditable(false);
        textTamano2.setEnabled(false);

        jLabel37.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel37.setText("X");

        textCostoVallaMaterial.setEditable(false);

        javax.swing.GroupLayout jPanel28Layout = new javax.swing.GroupLayout(jPanel28);
        jPanel28.setLayout(jPanel28Layout);
        jPanel28Layout.setHorizontalGroup(
            jPanel28Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel28Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel28Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel28Layout.createSequentialGroup()
                        .addComponent(jLabel36)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(textCostoVallaMaterial, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel28Layout.createSequentialGroup()
                        .addGroup(jPanel28Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel35)
                            .addComponent(jLabel34)
                            .addComponent(jLabel33))
                        .addGap(31, 31, 31)
                        .addGroup(jPanel28Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(textIdVallaMaterial, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(textNombreVallaMaterial, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel28Layout.createSequentialGroup()
                                .addComponent(textTamano1)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel37)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(textTamano2, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addContainerGap(94, Short.MAX_VALUE))
        );
        jPanel28Layout.setVerticalGroup(
            jPanel28Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel28Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel28Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(textNombreVallaMaterial, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel34))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel28Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(textIdVallaMaterial, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel33))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel28Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel35)
                    .addComponent(textTamano1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(textTamano2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel37))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel28Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel36)
                    .addComponent(textCostoVallaMaterial, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(266, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel26Layout = new javax.swing.GroupLayout(jPanel26);
        jPanel26.setLayout(jPanel26Layout);
        jPanel26Layout.setHorizontalGroup(
            jPanel26Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel26Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel27, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel28, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(80, Short.MAX_VALUE))
        );
        jPanel26Layout.setVerticalGroup(
            jPanel26Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel26Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel26Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel28, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel27, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        tabbedPanel.addTab("Valla/Material", jPanel26);

        back_Button.setFont(new java.awt.Font("Tahoma", 0, 12));
        back_Button.setText("Atras");
        back_Button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                back_ButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(10, 10, 10)
                .addComponent(tabbedPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(833, Short.MAX_VALUE)
                .addComponent(back_Button, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(tabbedPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(back_Button, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void buttonBorrarClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonBorrarClienteActionPerformed
int confirmacion = JOptionPane.showConfirmDialog(this, "¿Desea borrar al cliente y todas la información asociada a este?");

if(confirmacion == 0){
    try {
        Connection con = OracleMethods.oracleConnection();
        Statement sentencia = con.createStatement();
        sentencia.executeQuery("DELETE FROM ao_cliente WHERE rif_pk = '" + textRif.getText() + "'");
        limpiarTextsCliente();
        llenarTablaClientes();
        
        sentencia.close();
        con.close();
        
    } catch (SQLException ex) {
        JOptionPane.showMessageDialog(this, "Error, borre los servicios relacionados a este cliente");
        Logger.getLogger(BaseDatosGUI.class.getName()).log(Level.SEVERE, null, ex);
    }   
}
}//GEN-LAST:event_buttonBorrarClienteActionPerformed

private void buttonEditarClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonEditarClienteActionPerformed
if(textRif.getText().equals("--")){
    JOptionPane.showMessageDialog(this, "Seleccione un Cliente");
    return;
}
if(buttonEditarCliente.getText().equals("Editar")){
    //Desactivamos la navegacion a otras pantallas, botones y activamos los texts
    tabbedPanel.setEnabled(false);
    tableCliente.setEnabled(false);
    textTelefono2Cliente.setEditable(true);
    textTelefonoCliente.setEditable(true);
    textContacto.setEditable(true);
    textEmpresa.setEditable(true);
    buttonEditarCliente.setText("Confirmar");
    buttonRegistrarCliente.setEnabled(false);
    buttonBorrarCliente.setEnabled(false);
       
}
else{ 
    if(camposVaciosCliente())
        return;
    //Activamos la navegacion a otras pantallas, botones y desactivamos los texts
    tabbedPanel.setEnabled(true);
    tableCliente.setEnabled(true);
    textTelefono2Cliente.setEditable(false);
    textTelefonoCliente.setEditable(false);
    textContacto.setEditable(false);
    textEmpresa.setEditable(false);
    buttonEditarCliente.setText("Editar");
    buttonRegistrarCliente.setEnabled(true);
    buttonBorrarCliente.setEnabled(true);
    
    try{
    Connection con = OracleMethods.oracleConnection();
    Statement sentencia = con.createStatement(); 
    sentencia.executeQuery("Update ao_cliente SET "
                            + "nombreEmpresa = '" + textEmpresa.getText() + "' ,"
                            + "personaContacto = '" + textContacto.getText() + "' ," 
                            + "telefono1 = '" + textTelefonoCliente.getText()  + "' ,"
                            + "telefono2 = '" + textTelefono2Cliente.getText() + "'"
                            + "WHERE rif_pk = '" + textRif.getText() + "'");
    
    sentencia.close();
    con.close();
    
    }
    catch(SQLException e){
        System.out.println("SQL error");
        JOptionPane.showMessageDialog(this, "SQL Error");
        return;
    }
    
    JOptionPane.showMessageDialog(this, "Edición Exitosa");
    try {
        llenarTablaClientes();
    } catch (SQLException ex) {
        Logger.getLogger(BaseDatosGUI.class.getName()).log(Level.SEVERE, null, ex);
    }
}
}//GEN-LAST:event_buttonEditarClienteActionPerformed

private void buttonRegistrarClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRegistrarClienteActionPerformed

if(buttonRegistrarCliente.getText().equals("Registrar")){
    //Desactivamos la navegacion a otras pantallas, botones y activamos los texts
    tabbedPanel.setEnabled(false);
    tableCliente.setEnabled(false);
    textRif.setEditable(true);
    textTelefono2Cliente.setEditable(true);
    textTelefonoCliente.setEditable(true);
    textContacto.setEditable(true);
    textEmpresa.setEditable(true);
    buttonRegistrarCliente.setText("Confirmar");
    buttonEditarCliente.setEnabled(false);
    buttonBorrarCliente.setEnabled(false);
    limpiarTextsCliente();
       
}
else{  
    if(camposVaciosCliente())
        return;
    //Activamos la navegacion a otras pantallas, botones y desactivamos los texts
    tabbedPanel.setEnabled(true);
    tableCliente.setEnabled(true);
    textRif.setEditable(false);
    textTelefono2Cliente.setEditable(false);
    textTelefonoCliente.setEditable(false);
    textContacto.setEditable(false);
    textEmpresa.setEditable(false);
    buttonRegistrarCliente.setText("Registrar");
    buttonEditarCliente.setEnabled(true);
    buttonBorrarCliente.setEnabled(true);
    
    try{
    Connection con = OracleMethods.oracleConnection();
    Statement sentencia = con.createStatement();
    sentencia.executeQuery("INSERT INTO ao_cliente (rif_pk, personaContacto, nombreEmpresa, "
                            + "telefono1, telefono2)"
                            + "VALUES ("
                            + "'" + textRif.getText() + "' ,"
                            + "'" + textContacto.getText() + "' ,"
                            + "'" + textEmpresa.getText() + "' ,"
                            + "'" + textTelefonoCliente.getText() + "' ,"
                            + "'" + textTelefonoCliente.getText() + "')");
    
    sentencia.close();
    con.close();
    
    }
    catch(SQLException e){
        System.out.println("SQL error");
        JOptionPane.showMessageDialog(this, "Este RIF ya esta registrado");
        return;
    }
    
    JOptionPane.showMessageDialog(this, "Registro Exitoso");
    try {
        llenarTablaClientes();
    } catch (SQLException ex) {
        Logger.getLogger(BaseDatosGUI.class.getName()).log(Level.SEVERE, null, ex);
    }
   
}
}//GEN-LAST:event_buttonRegistrarClienteActionPerformed

private void textRifActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textRifActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_textRifActionPerformed

private void buttonGastosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonGastosActionPerformed
        try {
            GastosGUI gastos = new GastosGUI(this,true,textIdKiosco.getText());
            gastos.setLocationRelativeTo(null);
            gastos.setVisible(true);
        } catch (SQLException ex) {
            Logger.getLogger(BaseDatosGUI.class.getName()).log(Level.SEVERE, null, ex);
        }
}//GEN-LAST:event_buttonGastosActionPerformed

private void buttonBorrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonBorrarActionPerformed
int confirmacion = JOptionPane.showConfirmDialog(this, "¿Desea borrar el kiosco seleccionado?");

if(confirmacion == 0){
    try {
        Connection con = OracleMethods.oracleConnection();
        Statement sentencia = con.createStatement(); 
        sentencia.executeQuery("DELETE FROM ao_kiosco WHERE kiosco_pk = '" + textIdKiosco.getText() + "'");
        limpiarTexts();
        llenarTablaKiosco();
        
        sentencia.close();
        con.close();
        
    } catch (SQLException ex) {
        JOptionPane.showMessageDialog(this, "Error, borre los servicios relacionados a este kiosco");
        Logger.getLogger(BaseDatosGUI.class.getName()).log(Level.SEVERE, null, ex);
    }   
}
    


}//GEN-LAST:event_buttonBorrarActionPerformed

private void buttonEditarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonEditarActionPerformed
if(textIdKiosco.getText().equals("--")){
    JOptionPane.showMessageDialog(this, "Seleccione un kiosco");
    return;
}
if(buttonEditar.getText().equals("Editar")){
    //Desactivamos la navegacion a otras pantallas, botones y activamos los texts
    tabbedPanel.setEnabled(false);
    tableKiosco.setEnabled(false);
    textCiDueno.setEditable(true);
    textCostoAtras.setEditable(true);
    textCostoDerecha.setEditable(true);
    textCostoIzquierda.setEditable(true);
    textDuenoKiosco.setEditable(true);
    textNombreKiosco.setEditable(true);
    textTelefonoKiosco.setEditable(true);
    textCalleKiosco.setEditable(true);
    textDireccionKiosco.setEditable(true);
    textDireccionKiosco.setText("");
    buttonEditar.setText("Confirmar");
    buttonGastos.setEnabled(false);
    buttonRegistrar.setEnabled(false);
    buttonBorrar.setEnabled(false);
       
}
else{ 
    if(camposVaciosKiosco())
        return;
    //Activamos la navegacion a otras pantallas, botones y desactivamos los texts
    tabbedPanel.setEnabled(true);
    tableKiosco.setEnabled(false);
    textCiDueno.setEditable(false);
    textCostoAtras.setEditable(false);
    textCostoDerecha.setEditable(false);
    textCostoIzquierda.setEditable(false);
    textDuenoKiosco.setEditable(false);
    textNombreKiosco.setEditable(false);
    textTelefonoKiosco.setEditable(false);
    textCalleKiosco.setEditable(false);
    textDireccionKiosco.setEditable(false);
    buttonEditar.setText("Editar");
    buttonGastos.setEnabled(true);
    buttonRegistrar.setEnabled(true);
    buttonBorrar.setEnabled(true);
    
    try{
    Connection con = OracleMethods.oracleConnection();
    Statement sentencia = con.createStatement(); 
    sentencia.executeQuery("Update ao_kiosco SET dueno_ci = '" + textCiDueno.getText() + "' ,"
                            + "dueno_nombre = '" + textDuenoKiosco.getText() + "' ,"
                            + "costo_atras = '" + textCostoAtras.getText() + "' ," 
                            + "costo_derecha = '" + textCostoDerecha.getText()  + "' ,"
                            + "costo_izquierda = '" + textCostoIzquierda.getText() + "' ,"
                            + "nombre = '" + textNombreKiosco.getText() + "' ,"
                            + "telefono = '" + textTelefonoKiosco.getText() + "' ,"
                            + "calle = '" + textCalleKiosco.getText() + "' ,"
                            + "direccion_fk = '" + resultadoModal + "' "
                            + "WHERE kiosco_pk = '" + textIdKiosco.getText() + "'");
    
    sentencia.close();
    con.close();
    
    }
    catch(SQLException e){
        System.out.println("SQL error");
        JOptionPane.showMessageDialog(this, "SQL Error");
        return;
    }
    
    JOptionPane.showMessageDialog(this, "Edición Exitosa");
    try {
        llenarTablaKiosco();
    } catch (SQLException ex) {
        Logger.getLogger(BaseDatosGUI.class.getName()).log(Level.SEVERE, null, ex);
    }
}
}//GEN-LAST:event_buttonEditarActionPerformed

private void buttonRegistrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRegistrarActionPerformed

if(buttonRegistrar.getText().equals("Registrar")){
    //Desactivamos la navegacion a otras pantallas, botones y activamos los texts
    tabbedPanel.setEnabled(false);
    tableKiosco.setEnabled(false);
    textCiDueno.setEditable(true);
    textCostoAtras.setEditable(true);
    textCostoDerecha.setEditable(true);
    textCostoIzquierda.setEditable(true);
    textDuenoKiosco.setEditable(true);
    textNombreKiosco.setEditable(true);
    textTelefonoKiosco.setEditable(true);
    textCalleKiosco.setEditable(true);
    textDireccionKiosco.setEditable(true);
    textDireccionKiosco.setText("");
    buttonRegistrar.setText("Confirmar");
    buttonGastos.setEnabled(false);
    buttonEditar.setEnabled(false);
    buttonBorrar.setEnabled(false);
    limpiarTexts();
       
}
else{  
    if(camposVaciosKiosco())
        return;
    //Activamos la navegacion a otras pantallas, botones y desactivamos los texts
    tabbedPanel.setEnabled(true);
    tableKiosco.setEnabled(true);
    textCiDueno.setEditable(false);
    textCostoAtras.setEditable(false);
    textCostoDerecha.setEditable(false);
    textCostoIzquierda.setEditable(false);
    textDuenoKiosco.setEditable(false);
    textNombreKiosco.setEditable(false);
    textTelefonoKiosco.setEditable(false);
    textCalleKiosco.setEditable(false);
    textDireccionKiosco.setEditable(false);
    buttonRegistrar.setText("Registrar");
    buttonGastos.setEnabled(true);
    buttonEditar.setEnabled(true);
    buttonBorrar.setEnabled(true);
    
    try{
    Connection con = OracleMethods.oracleConnection();
    Statement sentencia = con.createStatement();
    sentencia.executeQuery("INSERT INTO ao_kiosco (kiosco_pk, dueno_ci, dueno_nombre, "
                            + "costo_atras, costo_derecha, costo_izquierda, nombre, telefono,"
                            + " calle, direccion_fk) "
                            + "VALUES (kiosco_pk.nextval,"
                            + "'" + textCiDueno.getText() + "' ,"
                            + "'" + textDuenoKiosco.getText() + "' ,"
                            + textCostoAtras.getText() + " ," 
                            + textCostoDerecha.getText()  + " ,"
                            + textCostoIzquierda.getText() + " ,"
                            + "'" + textNombreKiosco.getText() + "' ,"
                            + "'" + textTelefonoKiosco.getText() + "' ,"
                            + "'" + textCalleKiosco.getText() + "' ,"
                            + resultadoModal +")");
    
    sentencia.close();
    con.close();
    
    }
    catch(SQLException e){
        System.out.println("SQL error");
        JOptionPane.showMessageDialog(this, "SQL Error");
        return;
    }
    
    JOptionPane.showMessageDialog(this, "Registro Exitoso");
    try {
        llenarTablaKiosco();
    } catch (SQLException ex) {
        Logger.getLogger(BaseDatosGUI.class.getName()).log(Level.SEVERE, null, ex);
    }
}
}//GEN-LAST:event_buttonRegistrarActionPerformed

private void tableKioscoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tableKioscoMouseClicked
if(!tableKiosco.isEnabled())
    return;
    
    int row = this.tableKiosco.getSelectedRow();
    String idKiosco = (String) this.tableKiosco.getModel().getValueAt(row, 0).toString();
    ResultSet kioscoSet = null;
    String direccion = "";
    this.buttonBorrar.setEnabled(true);
    this.buttonGastos.setEnabled(true);
    this.buttonEditar.setEnabled(true);
     
    try {
        
    Connection con = OracleMethods.oracleConnection();
    Statement sentencia = con.createStatement();
    kioscoSet = sentencia.executeQuery("SELECT * FROM ao_kiosco WHERE ao_kiosco.kiosco_PK = " + idKiosco);  
    
    if(kioscoSet.next()){
        textIdKiosco.setText(kioscoSet.getString("kiosco_PK"));
        textCiDueno.setText(kioscoSet.getString("dueno_ci"));
        textCostoAtras.setText(kioscoSet.getString("costo_atras"));
        textCostoDerecha.setText(kioscoSet.getString("costo_izquierda"));
        textCostoIzquierda.setText(kioscoSet.getString("costo_izquierda"));
        textCalleKiosco.setText(kioscoSet.getString("calle"));
        textDuenoKiosco.setText(kioscoSet.getString("dueno_nombre"));
        textNombreKiosco.setText(kioscoSet.getString("nombre"));
        textTelefonoKiosco.setText(kioscoSet.getString("telefono"));
        kioscoSet = sentencia.executeQuery("SELECT * FROM ao_direccion WHERE ao_direccion.direccion_PK =" 
                                          + kioscoSet.getString("direccion_fk"));

        if(kioscoSet.next() && kioscoSet.getString("direccion_fk") != ""){
            direccion = kioscoSet.getString("nombre") + "  " + direccion;
            kioscoSet = sentencia.executeQuery("SELECT * FROM ao_direccion WHERE ao_direccion.direccion_PK =" 
                                          + kioscoSet.getString("direccion_fk"));
        }
        textDireccionKiosco.setText(direccion);
    }
    
    sentencia.close();
    kioscoSet.close();
    con.close();
    
    } catch (SQLException ex) {
        Logger.getLogger(BaseDatosGUI.class.getName()).log(Level.SEVERE, null, ex);
    }
}//GEN-LAST:event_tableKioscoMouseClicked

private void tableClienteMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tableClienteMouseClicked
if(!tableCliente.isEnabled())
    return;
    
    int row = this.tableCliente.getSelectedRow();
    String rif = (String) this.tableCliente.getModel().getValueAt(row, 0).toString();
    ResultSet clienteSet = null;
    this.buttonEditarCliente.setEnabled(true);
    this.buttonBorrarCliente.setEnabled(true);
     
    try {
        
    Connection con = OracleMethods.oracleConnection();
    Statement sentencia = con.createStatement();
    clienteSet = sentencia.executeQuery("SELECT * FROM ao_cliente WHERE ao_cliente.rif_PK =" + rif); 
    
    if(clienteSet.next()){
        textRif.setText(clienteSet.getString("rif_pk"));
        textContacto.setText(clienteSet.getString("personaContacto"));
        textTelefonoCliente.setText(clienteSet.getString("telefono1"));
        textTelefono2Cliente.setText(clienteSet.getString("telefono2"));
        textEmpresa.setText(clienteSet.getString("nombreEmpresa"));
    }
    
    sentencia.close();
    clienteSet.close();
    con.close();
    
    } catch (SQLException ex) {
        Logger.getLogger(BaseDatosGUI.class.getName()).log(Level.SEVERE, null, ex);
    }
}//GEN-LAST:event_tableClienteMouseClicked

private void buttonRegistrarDirecActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRegistrarDirecActionPerformed
if(buttonRegistrarDirec.getText().equals("Registrar")){
    //Desactivamos la navegacion a otras pantallas, botones y activamos los texts
    tabbedPanel.setEnabled(false);
    tableDirec.setEnabled(false);
    textNombreDirec.setEditable(true);
    textTipoDirec.setEnabled(true);
    textPerteneceDirec.setEditable(true);
    buttonRegistrarDirec.setText("Confirmar");
    buttonEditarDirec.setEnabled(false);
    buttonBorrarDirec.setEnabled(false);
    limpiarTextsDirec();       
}
else{  
    if(camposVaciosDirec())
        return;
    //Activamos la navegacion a otras pantallas, botones y desactivamos los texts
    tabbedPanel.setEnabled(true);
    tableDirec.setEnabled(true);
    textNombreDirec.setEditable(false);
    textTipoDirec.setEnabled(false);
    textPerteneceDirec.setEditable(false);
    buttonRegistrarDirec.setText("Registrar");
    buttonEditarDirec.setEnabled(true);
    buttonBorrarDirec.setEnabled(true);
    
    try{
        Connection con = OracleMethods.oracleConnection();
        Statement sentencia = con.createStatement(); 
        sentencia.executeQuery("INSERT INTO ao_direccion (direccion_pk, nombre, tipo, direccion_fk) "
                            + "VALUES ("
                            + "direccion_pk.nextval,"
                            + "'" + textNombreDirec.getText() + "' ,"
                            + "'" + textTipoDirec.getSelectedItem() + "' ,"
                            + "'" + resultadoModalDirec + "')");
        
        sentencia.close();
        con.close();
                          
    }
    catch(SQLException e){
        System.out.println("SQL error");
        return;
    }
    
    JOptionPane.showMessageDialog(this, "Registro Exitoso");
    try {
        llenarTablaDirec();
    } catch (SQLException ex) {
        Logger.getLogger(BaseDatosGUI.class.getName()).log(Level.SEVERE, null, ex);
    }
   
}   
}//GEN-LAST:event_buttonRegistrarDirecActionPerformed

private void buttonEditarDirecActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonEditarDirecActionPerformed
if(buttonEditarDirec.getText().equals("Editar")){
    //Desactivamos la navegacion a otras pantallas, botones y activamos los texts
    tabbedPanel.setEnabled(false);
    tableDirec.setEnabled(false);
    textNombreDirec.setEditable(true);
    textTipoDirec.setEnabled(true);
    textPerteneceDirec.setEditable(true);
    buttonEditarDirec.setText("Confirmar");
    buttonRegistrarDirec.setEnabled(false);
    buttonBorrarDirec.setEnabled(false);    
}
else{  
    if(camposVaciosDirec())
        return;
    //Activamos la navegacion a otras pantallas, botones y desactivamos los texts
    tabbedPanel.setEnabled(true);
    tableDirec.setEnabled(true);
    textNombreDirec.setEditable(false);
    textTipoDirec.setEnabled(false);
    textPerteneceDirec.setEditable(false);
    buttonEditarDirec.setText("Editar");
    buttonRegistrarDirec.setEnabled(true);
    buttonBorrarDirec.setEnabled(true);
    
    try{
        Connection con = OracleMethods.oracleConnection();
        Statement sentencia = con.createStatement();
        sentencia.executeQuery("UPDATE ao_direccion SET "
                            + "nombre = '" + textNombreDirec.getText() + "' ,"
                            + "tipo = '" + textTipoDirec.getSelectedItem().toString() + "' ,"
                            + "direccion_fk = '" + resultadoModalDirec + "' "
                            + "WHERE direccion_pk = '" + textIdDirec.getText() + "'");
    
    sentencia.close();
    con.close();
                         
    }
    catch(SQLException ex){
        System.out.println("SQL error");
        Logger.getLogger(BaseDatosGUI.class.getName()).log(Level.SEVERE, null, ex);
        return;
    }
    
    JOptionPane.showMessageDialog(this, "Edicion Exitosa");
    try {
        llenarTablaDirec();
    } catch (SQLException ex) {
        Logger.getLogger(BaseDatosGUI.class.getName()).log(Level.SEVERE, null, ex);
    }
   
}   
}//GEN-LAST:event_buttonEditarDirecActionPerformed

private void buttonBorrarDirecActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonBorrarDirecActionPerformed
int confirmacion = JOptionPane.showConfirmDialog(this, "¿Desea borrar la direccion y todas las direccions asociadas a esta?");

if(confirmacion == 0){
    try {
        Connection con = OracleMethods.oracleConnection();
        Statement sentencia = con.createStatement();
        sentencia.executeQuery("DELETE FROM ao_direccion WHERE direccion_pk = '" + textIdDirec.getText() + "'");
        
        limpiarTextsDirec();
        llenarTablaDirec();
        llenarTablaKiosco();
        
        sentencia.close();
        con.close();
        
    } catch (SQLException ex) {
        Logger.getLogger(BaseDatosGUI.class.getName()).log(Level.SEVERE, null, ex);
    }   
    
}
}//GEN-LAST:event_buttonBorrarDirecActionPerformed

private void tableDirecMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tableDirecMouseClicked
if(!tableDirec.isEnabled())
    return;
    
    int row = this.tableDirec.getSelectedRow();
    String id = (String) this.tableDirec.getModel().getValueAt(row, 0).toString();
    ResultSet direcSet = null;
    this.buttonBorrarDirec.setEnabled(true);
    this.buttonEditarDirec.setEnabled(true);
     
    try {
        
    Connection con = OracleMethods.oracleConnection();
    Statement sentencia = con.createStatement();
    direcSet = sentencia.executeQuery("SELECT * FROM ao_direccion WHERE direccion_PK =" + id); 
    
    if(direcSet.next()){
        textIdDirec.setText(direcSet.getString("direccion_pk"));
        textNombreDirec.setText(direcSet.getString("nombre"));
        textTipoDirec.setSelectedItem(direcSet.getString("tipo"));
        direcSet = sentencia.executeQuery("SELECT * FROM ao_direccion WHERE ao_direccion.direccion_PK =" 
                                          + direcSet.getString("direccion_fk"));
        if(direcSet.next())
                textPerteneceDirec.setText(direcSet.getString("nombre"));
        else
                textPerteneceDirec.setText("--");
    }
    
    sentencia.close();
    direcSet.close();
    con.close();
    
    } catch (SQLException ex) {
        Logger.getLogger(BaseDatosGUI.class.getName()).log(Level.SEVERE, null, ex);
    }
}//GEN-LAST:event_tableDirecMouseClicked

private void textDireccionKioscoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_textDireccionKioscoMouseClicked
    if(textDireccionKiosco.isEditable()){
            try {
                CambioDireccionGUI modal = new CambioDireccionGUI(this, true);
                modal.setVisible(true);
                resultadoModal = modal.getZona();
                String direccion = "";
                
                Connection con = OracleMethods.oracleConnection();
                Statement sentencia = con.createStatement();
                ResultSet kioscoSet = sentencia.executeQuery("SELECT * FROM ao_direccion WHERE ao_direccion.direccion_PK =" 
                                          + modal.getZona());

                while(kioscoSet.next() && kioscoSet.getString("direccion_fk") != ""){
                    direccion = kioscoSet.getString("nombre") + "  " + direccion;
                    kioscoSet = sentencia.executeQuery("SELECT * FROM ao_direccion WHERE ao_direccion.direccion_PK =" 
                                                       + kioscoSet.getString("direccion_fk"));
                }
                textDireccionKiosco.setText(direccion);
                
                sentencia.close();
                kioscoSet.close();
                con.close();
                
            } catch (SQLException ex) {
                Logger.getLogger(BaseDatosGUI.class.getName()).log(Level.SEVERE, null, ex);
            }
    }
        
}//GEN-LAST:event_textDireccionKioscoMouseClicked

private void textTipoDirecActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textTipoDirecActionPerformed
if(!textTipoDirec.isEnabled())
    return;
if(textTipoDirec.getSelectedItem().equals("Estado")){
    textPerteneceDirec.setText("--");
    resultadoModalDirec = "";
    textPerteneceDirec.setEditable(false);
}
else{
    textPerteneceDirec.setText("");
    textPerteneceDirec.setEditable(true);
}
}//GEN-LAST:event_textTipoDirecActionPerformed

private void textPerteneceDirecActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textPerteneceDirecActionPerformed
    
}//GEN-LAST:event_textPerteneceDirecActionPerformed

private void textPerteneceDirecMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_textPerteneceDirecMouseClicked
    if(textTipoDirec.getSelectedItem().equals("Estado"))
         return;
    
    if(textPerteneceDirec.isEditable()){
            try {
                CambioDireccionGUI modal = new CambioDireccionGUI(this, true,textTipoDirec.getSelectedItem().toString());
                modal.setVisible(true);
                resultadoModalDirec = modal.getResultadoDirec();
                String direccion = "";
                
                Connection con = OracleMethods.oracleConnection();
                Statement sentencia = con.createStatement();
                ResultSet direcSet = sentencia.executeQuery("SELECT * FROM ao_direccion WHERE ao_direccion.direccion_PK =" 
                                          + modal.getResultadoDirec());

                while(direcSet.next() && direcSet.getString("direccion_fk") != ""){
                    direccion = direcSet.getString("nombre") + "  " + direccion;
                    direcSet = sentencia.executeQuery("SELECT * FROM ao_direccion WHERE ao_direccion.direccion_PK =" 
                                                       + direcSet.getString("direccion_fk"));
                }
                textPerteneceDirec.setText(direccion);
                
                sentencia.close();
                direcSet.close();
                con.close();
                
            } catch (SQLException ex) {
                Logger.getLogger(BaseDatosGUI.class.getName()).log(Level.SEVERE, null, ex);
            }
    }
}//GEN-LAST:event_textPerteneceDirecMouseClicked

private void textDireccionKioscoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textDireccionKioscoActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_textDireccionKioscoActionPerformed

private void back_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_back_ButtonActionPerformed
    this.dispose();
}//GEN-LAST:event_back_ButtonActionPerformed

private void registroFPButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_registroFPButtonActionPerformed
    if(this.registroFPButton.getText().equals("Registrar")){
        this.tipoPago_Text.setText("");
        this.descuento_Text.setText("");
        this.tipoPago_Text.setEditable(true);
        this.descuento_Text.setEditable(true);
        this.registroFPButton.setText("Confirmar");
        this.editarFPButton.setEnabled(false);
        this.borrarFPButton.setEnabled(false);
    }
    else{
        if ((this.tipoPago_Text.getText().equals("")) || (this.descuento_Text.getText().equals(""))){
            JOptionPane.showMessageDialog(this, "Error, campos incompletos o erroneos");
        }
        else{
            String formaPago = this.tipoPago_Text.getText();
            String descuento = this.descuento_Text.getText() + "%";
                try {
                    int resultado = CreacionInformacion.crearFormaPago(formaPago, descuento);
                    
                    if (resultado != 0){
                        JOptionPane.showMessageDialog(this, "Registro Exitoso");
                        this.limpiarCamposFormaPago();
                        this.llenarFormasPagoTable();
                    }
                    
                } catch (SQLException ex) {
                    System.out.println(ex);
                }
        }
    }
}//GEN-LAST:event_registroFPButtonActionPerformed

private void editarFPButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editarFPButtonActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_editarFPButtonActionPerformed

private void borrarFPButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_borrarFPButtonActionPerformed
    
}//GEN-LAST:event_borrarFPButtonActionPerformed

private void tabbedPanelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tabbedPanelMouseClicked
    if(this.tabbedPanel.getSelectedIndex() == 3){
            try {
                this.llenarFormasPagoTable();
            } catch (SQLException ex) {
                System.out.println(ex);
            }
    }
}//GEN-LAST:event_tabbedPanelMouseClicked

private void formasPago_TableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formasPago_TableMouseClicked
    this.tipoPago_Text.setText("");
    this.descuento_Text.setText("");
    
    int row = this.formasPago_Table.getSelectedRow();
    
    Integer nroFormaPago = Integer.parseInt(this.formasPago_Table.getModel().getValueAt(row, 0).toString());
    String tipoFormaPago = (String) this.formasPago_Table.getModel().getValueAt(row, 1).toString();
    String descuento = (String) this.formasPago_Table.getModel().getValueAt(row, 2).toString();
    
    this.tipoPago_Text.setText(tipoFormaPago);
    this.descuento_Text.setText(descuento);
    this.borrarFPButton.setEnabled(true);
    this.editarFPButton.setEnabled(true);
}//GEN-LAST:event_formasPago_TableMouseClicked

private void textCostoDerechaKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textCostoDerechaKeyTyped
    if (textCostoDerecha.getText().length() > 4)
        evt.consume();
    else{
        char caracter = evt.getKeyChar();
        // Verificar si la tecla pulsada no es un digito
        if(((caracter < '0') || (caracter > '9')) && (caracter != '\b')){
            evt.consume();  // ignorar el evento de teclado
        }
    }
}//GEN-LAST:event_textCostoDerechaKeyTyped

private void textCostoAtrasKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textCostoAtrasKeyTyped
    if (textCostoAtras.getText().length() > 4)
        evt.consume();
    else{
        char caracter = evt.getKeyChar();
        // Verificar si la tecla pulsada no es un digito
        if(((caracter < '0') || (caracter > '9')) && (caracter != '\b')){
            evt.consume();  // ignorar el evento de teclado
        }
    }
}//GEN-LAST:event_textCostoAtrasKeyTyped

private void textCostoIzquierdaKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textCostoIzquierdaKeyTyped
    if (textCostoIzquierda.getText().length() > 4)
        evt.consume();
    else{
        char caracter = evt.getKeyChar();
        // Verificar si la tecla pulsada no es un digito
        if(((caracter < '0') || (caracter > '9')) && (caracter != '\b')){
            evt.consume();  // ignorar el evento de teclado
        }
    }
}//GEN-LAST:event_textCostoIzquierdaKeyTyped

private void textTelefonoKioscoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textTelefonoKioscoKeyTyped
    if (textTelefonoKiosco.getText().length() > 10)
        evt.consume();
    else{
        char caracter = evt.getKeyChar();
        // Verificar si la tecla pulsada no es un digito
        if(((caracter < '0') || (caracter > '9')) && (caracter != '\b')){
            evt.consume();  // ignorar el evento de teclado
        }
    }
}//GEN-LAST:event_textTelefonoKioscoKeyTyped

private void textCiDuenoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textCiDuenoKeyTyped
    if (textCiDueno.getText().length() > 8)
        evt.consume();
    else{
        char caracter = evt.getKeyChar();
        // Verificar si la tecla pulsada no es un digito
        if(((caracter < '0') || (caracter > '9')) && (caracter != '\b')){
            evt.consume();  // ignorar el evento de teclado
        }
    }
}//GEN-LAST:event_textCiDuenoKeyTyped

private void textTelefonoClienteKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textTelefonoClienteKeyTyped
    if (textTelefonoCliente.getText().length() > 10)
        evt.consume();
    else{
        char caracter = evt.getKeyChar();
        // Verificar si la tecla pulsada no es un digito
        if(((caracter < '0') || (caracter > '9')) && (caracter != '\b')){
            evt.consume();  // ignorar el evento de teclado
        }
    }
}//GEN-LAST:event_textTelefonoClienteKeyTyped

private void textTelefono2ClienteKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textTelefono2ClienteKeyTyped
    if (textTelefono2Cliente.getText().length() > 10)
        evt.consume();
    else{
        char caracter = evt.getKeyChar();
        // Verificar si la tecla pulsada no es un digito
        if(((caracter < '0') || (caracter > '9')) && (caracter != '\b')){
            evt.consume();  // ignorar el evento de teclado
        }
    }
}//GEN-LAST:event_textTelefono2ClienteKeyTyped

private void descuento_TextKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_descuento_TextKeyTyped
    if (descuento_Text.getText().length() > 1)
        evt.consume();
    else{
        char caracter = evt.getKeyChar();
        // Verificar si la tecla pulsada no es un digito
        if(((caracter < '0') || (caracter > '9')) && (caracter != '\b')){
            evt.consume();  // ignorar el evento de teclado
        }
    }
}//GEN-LAST:event_descuento_TextKeyTyped

private void descuento_TextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_descuento_TextActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_descuento_TextActionPerformed

private void formasPago_Table1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formasPago_Table1MouseClicked
// TODO add your handling code here:
}//GEN-LAST:event_formasPago_Table1MouseClicked

private void registroFPButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_registroFPButton1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_registroFPButton1ActionPerformed

private void editarFPButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editarFPButton1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_editarFPButton1ActionPerformed

private void borrarFPButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_borrarFPButton1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_borrarFPButton1ActionPerformed

private void descuento_Text1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_descuento_Text1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_descuento_Text1ActionPerformed

private void descuento_Text1KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_descuento_Text1KeyTyped
// TODO add your handling code here:
}//GEN-LAST:event_descuento_Text1KeyTyped

private void tablaVallaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tablaVallaMouseClicked
    int row = this.tablaValla.getSelectedRow();
    String id = (String) this.tablaValla.getModel().getValueAt(row, 0).toString();
    String nombre = (String) this.tablaValla.getModel().getValueAt(row, 1).toString();
    textNombreMaterial.setText(nombre);
    textIdMaterial.setText(id);
    
     
    
    
}//GEN-LAST:event_tablaVallaMouseClicked

private void botonRegistrarMaterialActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonRegistrarMaterialActionPerformed

if(botonRegistrarMaterial.getText().equals("Registrar")){
    //Desactivamos la navegacion a otras pantallas, botones y activamos los texts
    tabbedPanel.setEnabled(false);
    textNombreMaterial.setEditable(true);
    botonRegistrarMaterial.setText("Confirmar");
    botonEditarMaterial.setEnabled(false);
    botonBorrarMaterial.setEnabled(false);
    textNombreMaterial.setText("");
       
}
else{  
    //Activamos la navegacion a otras pantallas, botones y desactivamos los texts
    tabbedPanel.setEnabled(true);
    textNombreMaterial.setEditable(false);
    botonRegistrarMaterial.setText("Registrar");
    botonEditarMaterial.setEnabled(true);
    botonBorrarMaterial.setEnabled(true);
    
    try{
    Connection con = OracleMethods.oracleConnection();
    Statement sentencia = con.createStatement();
    sentencia.executeQuery("INSERT INTO ao_material (material_pk, material)"
                            + "VALUES (material_pk.nextval,"
                            + "'" + textNombreMaterial.getText() + "')");
    
    sentencia.close();
    con.close();
    llenarTablaMaterial();
    }
    catch(SQLException e){
        System.out.println("SQL error");
        return;
    }
    
    JOptionPane.showMessageDialog(this, "Registro Exitoso");
    try {
        llenarTablaClientes();
    } catch (SQLException ex) {
        Logger.getLogger(BaseDatosGUI.class.getName()).log(Level.SEVERE, null, ex);
    }
   
}
}//GEN-LAST:event_botonRegistrarMaterialActionPerformed

private void botonEditarMaterialActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonEditarMaterialActionPerformed
if(botonEditarMaterial.getText().equals("Editar")){
    //Desactivamos la navegacion a otras pantallas, botones y activamos los texts
    tabbedPanel.setEnabled(false);
    textNombreMaterial.setEditable(true);
    botonEditarMaterial.setText("Confirmar");
    botonRegistrarMaterial.setEnabled(false);
    botonBorrarMaterial.setEnabled(false);    
}
else{  
    //Activamos la navegacion a otras pantallas, botones y desactivamos los texts
    tabbedPanel.setEnabled(true);
    textNombreMaterial.setEditable(false);
    botonEditarMaterial.setText("Editar");
    botonBorrarMaterial.setEnabled(true);
    botonRegistrarMaterial.setEnabled(true);
    
    try{
        Connection con = OracleMethods.oracleConnection();
        Statement sentencia = con.createStatement();
        sentencia.executeQuery("UPDATE ao_material SET "
                            + "material = '" + textNombreMaterial.getText() + 
                            "' WHERE material_pk = " + textIdMaterial.getText() );
    
    sentencia.close();
    con.close();
                         
    }
    catch(SQLException ex){
        System.out.println("SQL error");
        Logger.getLogger(BaseDatosGUI.class.getName()).log(Level.SEVERE, null, ex);
        return;
    }
    
    JOptionPane.showMessageDialog(this, "Edicion Exitosa");
    try {
        llenarTablaMaterial();
    } catch (SQLException ex) {
        Logger.getLogger(BaseDatosGUI.class.getName()).log(Level.SEVERE, null, ex);
    }
   
}
}//GEN-LAST:event_botonEditarMaterialActionPerformed

private void botonBorrarMaterialActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonBorrarMaterialActionPerformed
try {
        Connection con = OracleMethods.oracleConnection();
        Statement sentencia = con.createStatement();
        sentencia.executeQuery("DELETE FROM ao_material WHERE material = '" + textNombreMaterial.getText() + "'");
        
        llenarTablaMaterial();
        
        sentencia.close();
        con.close();
        
    } catch (SQLException ex) {
        Logger.getLogger(BaseDatosGUI.class.getName()).log(Level.SEVERE, null, ex);
    }   
}//GEN-LAST:event_botonBorrarMaterialActionPerformed

private void tablaValla1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tablaValla1MouseClicked
    int row = this.tablaValla1.getSelectedRow();
    String id = (String) this.tablaValla1.getModel().getValueAt(row, 0).toString();
    String nombre = (String) this.tablaValla1.getModel().getValueAt(row, 1).toString();
    textNombreMaterial1.setText(nombre);
    textIdMaterial1.setText(id);
    
     
    
// TODO add your handling code here:
}//GEN-LAST:event_tablaValla1MouseClicked

private void botonRegistrarMaterial1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonRegistrarMaterial1ActionPerformed

if(botonRegistrarMaterial1.getText().equals("Registrar")){
    //Desactivamos la navegacion a otras pantallas, botones y activamos los texts
    tabbedPanel.setEnabled(false);
    textNombreMaterial1.setEditable(true);
    botonRegistrarMaterial1.setText("Confirmar");
    botonEditarMaterial1.setEnabled(false);
    botonBorrarMaterial1.setEnabled(false);
    textNombreMaterial1.setText("");
       
}
else{  
    //Activamos la navegacion a otras pantallas, botones y desactivamos los texts
    tabbedPanel.setEnabled(true);
    textNombreMaterial1.setEditable(false);
    botonRegistrarMaterial1.setText("Registrar");
    botonEditarMaterial1.setEnabled(true);
    botonBorrarMaterial1.setEnabled(true);
    
    try{
    Connection con = OracleMethods.oracleConnection();
    Statement sentencia = con.createStatement();
    sentencia.executeQuery("INSERT INTO ao_valla (valla_pk, tamano)"
                            + "VALUES (valla_pk.nextval,"
                            + "'" + textNombreMaterial1.getText() + "')");
    
    sentencia.close();
    con.close();
    llenarTablaMaterial1();
    }
    catch(SQLException e){
        System.out.println("SQL error");
        return;
    }
    
    JOptionPane.showMessageDialog(this, "Registro Exitoso");
    try {
        llenarTablaClientes();
    } catch (SQLException ex) {
        Logger.getLogger(BaseDatosGUI.class.getName()).log(Level.SEVERE, null, ex);
    }
   
}
}//GEN-LAST:event_botonRegistrarMaterial1ActionPerformed

private void botonEditarMaterial1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonEditarMaterial1ActionPerformed
if(botonEditarMaterial1.getText().equals("Editar")){
    //Desactivamos la navegacion a otras pantallas, botones y activamos los texts
    tabbedPanel.setEnabled(false);
    textNombreMaterial1.setEditable(true);
    botonEditarMaterial1.setText("Confirmar");
    botonRegistrarMaterial1.setEnabled(false);
    botonBorrarMaterial1.setEnabled(false);    
}
else{  
    //Activamos la navegacion a otras pantallas, botones y desactivamos los texts
    tabbedPanel.setEnabled(true);
    textNombreMaterial1.setEditable(false);
    botonEditarMaterial1.setText("Editar");
    botonBorrarMaterial1.setEnabled(true);
    botonRegistrarMaterial1.setEnabled(true);
    
    try{
        Connection con = OracleMethods.oracleConnection();
        Statement sentencia = con.createStatement();
        sentencia.executeQuery("UPDATE ao_valla SET "
                            + "tamano = '" + textNombreMaterial1.getText() + 
                            "' WHERE valla_pk = " + textIdMaterial1.getText() );
    
    sentencia.close();
    con.close();
                         
    }
    catch(SQLException ex){
        System.out.println("SQL error");
        Logger.getLogger(BaseDatosGUI.class.getName()).log(Level.SEVERE, null, ex);
        return;
    }
    
    JOptionPane.showMessageDialog(this, "Edicion Exitosa");
    try {
        llenarTablaMaterial1();
    } catch (SQLException ex) {
        Logger.getLogger(BaseDatosGUI.class.getName()).log(Level.SEVERE, null, ex);
    }
   
}
}//GEN-LAST:event_botonEditarMaterial1ActionPerformed

private void botonBorrarMaterial1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonBorrarMaterial1ActionPerformed
try {
        Connection con = OracleMethods.oracleConnection();
        Statement sentencia = con.createStatement();
        sentencia.executeQuery("DELETE FROM ao_valla WHERE tamano = '" + textNombreMaterial1.getText() + "'");
        
        llenarTablaMaterial1();
        
        sentencia.close();
        con.close();
        
    } catch (SQLException ex) {
        Logger.getLogger(BaseDatosGUI.class.getName()).log(Level.SEVERE, null, ex);
    }// TODO add your handling code here:
}//GEN-LAST:event_botonBorrarMaterial1ActionPerformed

private void tablaValla2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tablaValla2MouseClicked
// TODO add your handling code here:
}//GEN-LAST:event_tablaValla2MouseClicked

private void botonRegistrarMaterial2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonRegistrarMaterial2ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_botonRegistrarMaterial2ActionPerformed

private void botonEditarMaterial2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonEditarMaterial2ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_botonEditarMaterial2ActionPerformed

private void botonBorrarMaterial2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonBorrarMaterial2ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_botonBorrarMaterial2ActionPerformed

//Metodo para cuando se selecciona un item de la tabla de kioscos
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(BaseDatosGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(BaseDatosGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(BaseDatosGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(BaseDatosGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                try {
                    new BaseDatosGUI().setVisible(true);
                } catch (SQLException ex) {
                    Logger.getLogger(BaseDatosGUI.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton back_Button;
    private javax.swing.JButton borrarFPButton;
    private javax.swing.JButton borrarFPButton1;
    private javax.swing.JButton botonBorrarMaterial;
    private javax.swing.JButton botonBorrarMaterial1;
    private javax.swing.JButton botonBorrarMaterial2;
    private javax.swing.JButton botonEditarMaterial;
    private javax.swing.JButton botonEditarMaterial1;
    private javax.swing.JButton botonEditarMaterial2;
    private javax.swing.JButton botonRegistrarMaterial;
    private javax.swing.JButton botonRegistrarMaterial1;
    private javax.swing.JButton botonRegistrarMaterial2;
    private javax.swing.JButton buttonBorrar;
    private javax.swing.JButton buttonBorrarCliente;
    private javax.swing.JButton buttonBorrarDirec;
    private javax.swing.JButton buttonEditar;
    private javax.swing.JButton buttonEditarCliente;
    private javax.swing.JButton buttonEditarDirec;
    private javax.swing.JButton buttonGastos;
    private javax.swing.JButton buttonRegistrar;
    private javax.swing.JButton buttonRegistrarCliente;
    private javax.swing.JButton buttonRegistrarDirec;
    private javax.swing.JTextField descuento_Text;
    private javax.swing.JTextField descuento_Text1;
    private javax.swing.JButton editarFPButton;
    private javax.swing.JButton editarFPButton1;
    private javax.swing.JTable formasPago_Table;
    private javax.swing.JTable formasPago_Table1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel34;
    private javax.swing.JLabel jLabel35;
    private javax.swing.JLabel jLabel36;
    private javax.swing.JLabel jLabel37;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel13;
    private javax.swing.JPanel jPanel14;
    private javax.swing.JPanel jPanel15;
    private javax.swing.JPanel jPanel16;
    private javax.swing.JPanel jPanel17;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel20;
    private javax.swing.JPanel jPanel21;
    private javax.swing.JPanel jPanel22;
    private javax.swing.JPanel jPanel23;
    private javax.swing.JPanel jPanel24;
    private javax.swing.JPanel jPanel25;
    private javax.swing.JPanel jPanel26;
    private javax.swing.JPanel jPanel27;
    private javax.swing.JPanel jPanel28;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JScrollPane jScrollPane8;
    private javax.swing.JScrollPane jScrollPane9;
    private javax.swing.JButton registroFPButton;
    private javax.swing.JButton registroFPButton1;
    private javax.swing.JTabbedPane tabbedPanel;
    private javax.swing.JTable tablaValla;
    private javax.swing.JTable tablaValla1;
    private javax.swing.JTable tablaValla2;
    private javax.swing.JTable tableCliente;
    private javax.swing.JTable tableDirec;
    private javax.swing.JTable tableKiosco;
    private javax.swing.JTextField textCalleKiosco;
    private javax.swing.JTextField textCiDueno;
    private javax.swing.JTextField textContacto;
    private javax.swing.JTextField textCostoAtras;
    private javax.swing.JTextField textCostoDerecha;
    private javax.swing.JTextField textCostoIzquierda;
    private javax.swing.JTextField textCostoVallaMaterial;
    private javax.swing.JTextField textDireccionKiosco;
    private javax.swing.JTextField textDuenoKiosco;
    private javax.swing.JTextField textEmpresa;
    private javax.swing.JTextField textIdDirec;
    private javax.swing.JTextField textIdKiosco;
    private javax.swing.JTextField textIdMaterial;
    private javax.swing.JTextField textIdMaterial1;
    private javax.swing.JTextField textIdVallaMaterial;
    private javax.swing.JTextField textNombreDirec;
    private javax.swing.JTextField textNombreKiosco;
    private javax.swing.JTextField textNombreMaterial;
    private javax.swing.JTextField textNombreMaterial1;
    private javax.swing.JTextField textNombreVallaMaterial;
    private javax.swing.JTextField textPerteneceDirec;
    private javax.swing.JTextField textRif;
    private javax.swing.JTextField textTamano1;
    private javax.swing.JTextField textTamano2;
    private javax.swing.JTextField textTelefono2Cliente;
    private javax.swing.JTextField textTelefonoCliente;
    private javax.swing.JTextField textTelefonoKiosco;
    private javax.swing.JComboBox textTipoDirec;
    private javax.swing.JTextField tipoPago_Text;
    private javax.swing.JTextField tipoPago_Text1;
    // End of variables declaration//GEN-END:variables
}
